<?php
require_once 'utilities/sessions.php';
require_once 'includes/access.php';
require_once 'includes/html.php';
require_once 'includes/menu.php';
class CamlotView{
	
	private $lang = '';
	
	public function __construct(){
		$this->lang = $this->getLanguage();	
	}
	
	public function getLanguage(){
		$lang = sessions::getSessionByName();
		if (file_exists('language/camlot_'.$lang.'.php')){
			require_once 'language/camlot_'.$lang.'.php';
		}else{
			require_once 'language/camlot_en.php';
		}
		return $lang;
	}
	public function camlotForm(){		
	?>
		<?php
		$user = sessions::getSession();
		if ( empty($user) ){
			Access::setRedirect("index.php");
		} 
		HTML::topHTML('Camlot');
		?>
		<LINK REL=StyleSheet HREF="views/css/camlot.css" TYPE="text/css" MEDIA=screen>
		<script src="views/js/query.min.js" language="javascript"></script>
		<script>
		$(function(){			
			getPostName();
			$("table.postname tbody tr td input").click(function (){
				getPostName();
			});
			getTimeSheet();
			$("ul.timesheet li input").click(function (){
				getTimeSheet();
			});
			getNumeric();
			$("table.numericTable tbody tr td input").click(function (){
				getNumeric();
			});
			
		});
		function getPostName(){
			$("table.postname tbody tr td input").each(function (){
				if ($(this).is(':checked')){
					$(".nameOfPost").text($(this).val());
				}
			});
		}
		function getTimeSheet(){
			$("ul.timesheet li input").each(function (){
				if ($(this).is(':checked')){
					$(".typeOfTime").text($(this).val());
				}
			});
		}
		function getNumeric(){
			$("table.numericTable tbody tr td input").each(function (){
				if ($(this).is(':checked')){
					$(".typeOfNumeric").text($(this).val());
				}
			});
		}
		</script>				
		<?php
		HTML::wrapperHeaderHTML(); 
		HTML::headerHTML( $user['name'], NEW_WORLD_LOTTORY );
		?>
			<div class="content">
				<div class="float_left content_left">
					<div class="showTime"><?php echo TIME?></div>
					<div class="showTimeValue">
						<ul class="timesheet">
							<li class="float_left">
								<span><input checked="checked" type="radio" name="timesheet" value="morning" />&nbsp;<?php echo MORNING?></span>
							</li>
							<li class="float_left">
								<span><input type="radio" name="timesheet" value="evening" />&nbsp;<?php echo EVENING?></span>
							</li>
							<li class="float_left">
								<span><input type="radio" name="timesheet" value="night" />&nbsp;<?php echo NIGHT?></span>
							</li>
						</ul>
					</div>	
					<div class="clear">&nbsp;</div>				
					<div class="showPost"><?php echo POST_NAME?></div>
					<div class="showPostValue">
						<table border="0" cellpadding="0" cellspacing="0" width="100%" class="postname">
						<tbody>
							<tr>
								<td><input checked="checked" type="radio" name="postname" value="ak" />&nbsp;<?php echo AK_ANKOR?></td>
								<td><input type="radio" name="postname" value="a_vn" />&nbsp;<?php echo A_VITNAME?></td>
							</tr>
							<tr>
								<td><input type="radio" name="postname" value="pw" />&nbsp;<?php echo PW_PTEWIN?></td>
								<td><input type="radio" name="postname" value="vn_lo" />&nbsp;<?php echo LO_VITNAME?></td>
							</tr>
							<tr>
								<td><input type="radio" name="postname" value="ol" />&nbsp;<?php echo OL_OLAMPIC?></td>
								<td><input type="radio" name="postname" value="vn_b" />&nbsp;<?php echo B_VITNAME?></td>
							</tr>
							<tr>
								<td><input type="radio" name="postname" value="pp" />&nbsp;<?php echo PP_PHNOMPENH?></td>
								<td><input type="radio" name="postname" value="vn_c" />&nbsp;<?php echo C_VITNAME?></td>
							</tr>
							<tr>
								<td><input type="radio" name="postname" value="m" />&nbsp;<?php echo OL_SOMBAT?></td>
								<td><input type="radio" name="postname" value="vn_d" />&nbsp;<?php echo D_VITNAME?></td>
							</tr>
							<tr>
								<td><input type="radio" name="postname" value="k" />&nbsp;<?php echo K_SACHIVAKAM?></td>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td><input type="radio" name="postname" value="klo" />&nbsp;<?php echo KLO_KLO?></td>
								<td>&nbsp;</td>
							</tr>
							<tr height="50px;">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
						</tbody>
						</table>													
					</div>
					<div class="showTime"><?php echo TIME?></div>
					<div class="showPostValue">
						<table border="0" cellpadding="0" cellspacing="0" width="100%" class="numericTable">
						<tbody>
							<tr>
								<td><input type="radio" name="nbnumeric" value="t2" />&nbsp;<?php echo NUMBER2?></td>
								<td><input checked="checked" type="radio" name="nbnumeric" value="u4" />&nbsp;<?php echo NUMBER4?></td>
							</tr>
							<tr>
								<td><input type="radio" name="nbnumeric" value="y3" />&nbsp;<?php echo NUMBER3?></td>
								<td><input type="radio" name="nbnumeric" value="i5" />&nbsp;<?php echo NUMBER5?></td>
							</tr>
							<tr height="50px;">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
						</tbody>
						</table>
					</div>
				</div>
				<div class="float_right content_right">
					<table border="0" cellpadding="0" cellspacing="0" width="100%" class="lottory">
					<tbody>
						<tr class="result">
							<td class="resultLottry"> <?php echo RESULT_OF_LOTTORY?> <span class="nameOfPost"></span>&nbsp;<span class="typeOfTime"></span></td>
							<td><input type="text" name="date" value="" /></td>
						</tr>
						<tr class="result">
							<td class="resultLottry"> <?php echo NUMBER?><span class="typeOfNumeric"></span><?php echo RESULT_HAS_RESULTED?></td>
							<td><input type="text" name="resultNumeric" value="" /></td>
						</tr>
					</tbody>
					</table>
				</div>				
				<div class="clear">&nbsp;</div>
			</div>
		<?php 	
		HTML::wrapperFooterHTML();
		menu::mainmenu( $this->lang );
		//HTML::footHTML();
	}
}
?>